package com.tom.joke.view.banner;

import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;

/**
 * Added by Tom on 2024/07/16.
 * 改变VP切换的速率。可修改切换页面的持续时间。
 */
public class BannerScroller extends Scroller {
    private int mScrollDuration = 800; // 动画持续的时间, 默认800ms。
    public void setScrollDuration(int duration) {
        this.mScrollDuration = duration;
    }

    public BannerScroller(Context context) {
        super(context);
    }
    // 设置插值器。
    public BannerScroller(Context context, Interpolator interpolator) {
        super(context, interpolator);
    }
    public BannerScroller(Context context, Interpolator interpolator, boolean flywheel) {
        super(context, interpolator, flywheel);
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy, int duration) {
        super.startScroll(startX, startY, dx, dy, mScrollDuration);
    }
}
